<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <meta charset="utf-8">
  <title>Storage inspector IndexedDBs with duplicate names</title>

  <script type="application/javascript;version=1.7">
    "use strict";

    function createIndexedDBs() {
      createIndexedDB("idb1", "temporary");
      createIndexedDB("idb1", "default");
      createIndexedDB("idb1", "persistent");
      createIndexedDB("idb2", "temporary");
      createIndexedDB("idb2", "default");
      createIndexedDB("idb2", "persistent");
    }

    function createIndexedDB(name, storage) {
      let open = indexedDB.open(name, {storage: storage});

      open.onsuccess = function () {
        let db = open.result;
        db.close();
      };
    }

    function deleteDB(dbName, storage) {
      return new Promise(resolve => {
        dump(`removing database ${dbName} (${storage}) from ${document.location}\n`);
        indexedDB.deleteDatabase(dbName, { storage: storage }).onsuccess = resolve;
      });
    }

    window.clear = function* () {
      yield deleteDB("idb1", "temporary");
      yield deleteDB("idb1", "default");
      yield deleteDB("idb1", "persistent");
      yield deleteDB("idb2", "temporary");
      yield deleteDB("idb2", "default");
      yield deleteDB("idb2", "persistent");

      dump(`removed indexedDB data from ${document.location}\n`);
    };
  </script>
</head>
<body onload="createIndexedDBs()">
  <h1>storage-indexeddb-duplicate-names.html</h1>
</body>
</html>
